package SG3D

import (
	. "SGEngine"
	"fmt"
	"strings"
)

type Model struct {
	Meshs []*Mesh
}

func NewModel(ModelFile string) {
	var model *Model
	ext := strings.Split(ModelFile, ".")[1]
	if ext == "obj" {
		model = ModelReader.LoadObj(ModelFile)
	} else if ext == "sgm" {
		model = ModelReader.LoadSGM(ModelFile)
	}
	S := WinRoot.MainScene
	fmt.Println(model.Meshs[0].Inc)
	fmt.Println(model.Meshs[0].UV)
	for _, V := range model.Meshs {
		AddChild(S, V)
		V.SetScale(0.05, 0.05, 0.05)
	}
}

func (m *Model) BindBuffer() {
	for _, V := range m.Meshs {
		V.BindBuffer()
	}
}
